﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PM_Remote
{
	class Program
	{
		static void Main(string[] args)
		{
			PM_Server Srv = new PM_Server(50001);
			Srv.ClientConnected += (srv, srvcli) => Console.WriteLine("Client connected");
			Srv.ClientExit += (srv, srvcli) => Console.WriteLine("Client exited");
			Srv.Stopped += srv => Console.WriteLine("Server stopped");
			Srv.Start();
			Srv.onClientCreate += srvcli =>
			{
				Console.WriteLine("client creation:");
				srvcli.OnData += (sender, data) =>
				{
					Console.WriteLine("Incoming request: " + data.Length);
					Console.WriteLine(BitConverter.ToInt32(data, 4));
					Console.WriteLine(BitConverter.ToInt32(data, 8));
				};
			};
			PM_Client Cli = new PM_Client("localhost", 50001);
			Console.WriteLine(Cli.Connected);
			Cli.OpenProcess("firefox");
			System.Threading.Thread.Sleep(5000);
			Srv.Stop(true);
			Console.WriteLine("Done");
			Console.ReadKey(true);
		}
	}
}
